//
//  MyEvaluateCell.m
//  spotrs
//
//  Created by sky on 16/5/18.
//  Copyright © 2016年 TZ. All rights reserved.
//

#import "MyEvaluateCell.h"

@implementation MyEvaluateCell
{
    UILabel *_titlelbl;
    UILabel *_explainlbl;
    UILabel *_moneyexplainlbl;
    UILabel *_eventlbl;
    UILabel *_datelbl;
    UILabel *_moneylbl;
    UIImageView *_finishvi;
    
    UILabel *_evalbl;
    UILabel *_notevalbl;
}



- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self buildLayout];
    }
    return self;
}

-(void)buildLayout{
    UIView *bgview = [[UIView alloc]initWithFrame:CGRectMake(0, 5, SCREEN_WIDTH, 45)];
    bgview.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:bgview];
    
    _titlelbl = [self LabelWithRect:CGRectMake(15, 45/2 - 15/2, SCREEN_WIDTH - 15, 15) textColor:[UIColor blackColor] textstr:@"网球 - 约球" textfont:15 textstyle:NSTextAlignmentLeft];
    [bgview addSubview:_titlelbl];
    
    [self makeLinewithRect:CGRectMake(0, 44.5, SCREEN_WIDTH, .5) Color:[LCCommon getColor:@"ebebeb"] addview:bgview];
    
    [self makeLinewithRect:CGRectMake(0, 525/3 - .5, SCREEN_WIDTH, .5) Color:[LCCommon getColor:@"ebebeb"] addview:self.contentView];
    
    CGFloat space = (525/3 - 45 - 13 * 5 )/6;
    _explainlbl = [self LabelWithRect:CGRectMake(15, space + 50, SCREEN_WIDTH - 15, 13) textColor:[LCCommon getColor:@"999999"] textstr:@"奥林匹克中心  初级" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:_explainlbl];
    
    UILabel *feiyong = [self LabelWithRect:CGRectMake(15, _explainlbl.frame.origin.y + 13 + space, 13 * 2 + 13, 13) textColor:[LCCommon getColor:@"999999"] textstr:@"费用 :" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:feiyong];
    
    UILabel *huodong = [self LabelWithRect:CGRectMake(15, feiyong.frame.origin.y + 13 + space, 13 * 4 + 13, 13) textColor:[LCCommon getColor:@"999999"] textstr:@"活动方式 :" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:huodong];
    
    UILabel *shijian = [self LabelWithRect:CGRectMake(15, huodong.frame.origin.y + 13 + space, 13 * 4 + 13, 13) textColor:[LCCommon getColor:@"999999"] textstr:@"截止时间 :" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:shijian];
    
    UILabel *jine = [self LabelWithRect:CGRectMake(15, shijian.frame.origin.y  + 13 + space, 13 * 2 + 13 , 13) textColor:[LCCommon getColor:@"999999"] textstr:@"金额 :" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:jine];
    
    _moneyexplainlbl = [self LabelWithRect:CGRectMake(feiyong.frame.origin.x + feiyong.frame.size.width, feiyong.frame.origin.y, SCREEN_WIDTH - (feiyong.frame.origin.x + feiyong.frame.size.width), 13) textColor:[LCCommon getColor:@"999999"] textstr:@"AA制" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:_moneyexplainlbl];
    
    _eventlbl = [self LabelWithRect:CGRectMake(huodong.frame.origin.x + huodong.frame.size.width, huodong.frame.origin.y, SCREEN_WIDTH - (huodong.frame.origin.x + huodong.frame.size.width), 13) textColor:[LCCommon getColor:@"999999"] textstr:@"单打" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:_eventlbl];
    
    _datelbl = [self LabelWithRect:CGRectMake(shijian.frame.origin.x + shijian.frame.size.width, shijian.frame.origin.y, SCREEN_WIDTH - (shijian.frame.origin.x + shijian.frame.size.width), 13) textColor:[LCCommon getColor:@"999999"] textstr:@"2015-4-8" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:_datelbl];
    
    _moneylbl = [self LabelWithRect:CGRectMake(jine.frame.origin.x + jine.frame.size.width, jine.frame.origin.y, SCREEN_WIDTH - (jine.frame.origin.x + jine.frame.size.width), 13) textColor:[LCCommon getColor:@"999999"] textstr:@"170.0元" textfont:13 textstyle:NSTextAlignmentLeft];
    [self.contentView addSubview:_moneylbl];
    
    _evalbl = [self LabelWithRect:CGRectMake(SCREEN_WIDTH - 13 * 3 - 15, 45/2 - 13/2, 13 * 3, 13) textColor:[UIColor orangeColor] textstr:@"已评价" textfont:13 textstyle:NSTextAlignmentCenter];
    [bgview addSubview:_evalbl];
    
    _notevalbl = [self LabelWithRect:CGRectMake(SCREEN_WIDTH - 15 - 18 * 3, 525/3 - 18 - 10, 18 * 3, 18) textColor:[UIColor whiteColor] textstr:@"待评价" textfont:13 textstyle:NSTextAlignmentCenter];
    _notevalbl.backgroundColor = [UIColor orangeColor];
    _notevalbl.layer.cornerRadius = 6;
    _notevalbl.clipsToBounds = YES;
    [self.contentView addSubview:_notevalbl];
    
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

-(UIView *)makeLinewithRect:(CGRect)rect Color:(UIColor *)color addview:(UIView *)vi{
    UIView *line = [[UIView alloc]initWithFrame:rect];
    line.backgroundColor = color;
    [vi addSubview:line];
    return line;
}


-(UILabel *)LabelWithRect:(CGRect)rect textColor:(UIColor *)color textstr:(NSString *)str textfont:(int)font textstyle:(NSTextAlignment)aligment{
    UILabel *label = [[UILabel alloc] initWithFrame:rect];
    label.textColor = color;
    label.text = str;
    label.font = [UIFont systemFontOfSize:font];
    label.textAlignment = aligment;
    label.numberOfLines = 0;
    return label;
}


@end
